//-
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

include /app/helpers/jade/mixins
include /app/configuration/mixins

-var form = 'secondaryFileSystem'
-var model = 'backupItem'

panel-collapsible(ng-form=form on-open=`ui.loadPanel('${form}')`)
    panel-title Secondary file system
    panel-description
        | Secondary file system is provided for pass-through, write-through, and read-through purposes.
        a.link-success(href="https://apacheignite-fs.readme.io/docs/secondary-file-system" target="_blank") More info
    panel-content.pca-form-row(ng-if=`ui.isPanelLoaded('${form}')`)
        .pca-form-column-6.pc-form-grid-row
            -var enabled = `${model}.secondaryFileSystemEnabled`
            -var secondaryFileSystem = `${model}.secondaryFileSystem`

            .pc-form-grid-col-60
                +form-field__checkbox({
                    label: 'Enabled',
                    name: '"secondaryFileSystemEnabled"',
                    model: enabled
                })(
                    ng-model-options='{allowInvalid: true}'
                    ui-validate=`{
                        requiredWhenIGFSProxyMode: '$ctrl.IGFSs.secondaryFileSystemEnabled.requiredWhenIGFSProxyMode(${model})',
                        requiredWhenPathModeProxyMode: '$ctrl.IGFSs.secondaryFileSystemEnabled.requiredWhenPathModeProxyMode(${model})'
                    }`
                    ui-validate-watch-collection=`"[${model}.defaultMode, ${model}.pathModes]"`
                    ui-validate-watch-object-equality='true'
                )
                    +form-field__error({ error: 'requiredWhenIGFSProxyMode', message: 'Secondary file system should be configured for "PROXY" IGFS mode' })
                    +form-field__error({ error: 'requiredWhenPathModeProxyMode', message: 'Secondary file system should be configured for "PROXY" path mode' })
            .pc-form-grid-col-60
                +form-field__text({
                    label: 'URI:',
                    model: `${secondaryFileSystem}.uri`,
                    name: '"hadoopURI"',
                    disabled: `!(${enabled})`,
                    placeholder: 'hdfs://[namenodehost]:[port]/[path]',
                    tip: 'URI of file system'
                })
            .pc-form-grid-col-60
                +form-field__text({
                    label: 'Config path:',
                    model: `${secondaryFileSystem}.cfgPath`,
                    name: '"cfgPath"',
                    disabled: `!(${enabled})`,
                    placeholder: 'Path to additional config',
                    tip: 'Additional path to Hadoop configuration'
                })
            .pc-form-grid-col-60
                +form-field__text({
                    label: 'User name:',
                    model: `${secondaryFileSystem}.userName`,
                    name: '"userName"',
                    disabled: `!(${enabled})`,
                    placeholder: 'Input user name',
                    tip: 'User name'
                })
        .pca-form-column-6
            +preview-xml-java(model, 'igfsSecondFS')
